<template>

	<view class="">
		<view v-if="!isloading">
			<!-- 代理商 -->
			<view class="container" v-if="type=='agent'">
				<view class="form">
					<view class="formitem">
						<view class="label">
							姓名
						</view>
						<view class="input">
							{{info.name||''}}
						</view>
					</view>
					<view class="formitem">
						<view class="label">
							代理地址
						</view>
						<view class="input">
							{{info.address||''}}
						</view>
					</view>
					<view class="formitem">
						<view class="label">
							联系电话
						</view>
						<view class="input">
							{{info.phone||''}}
						</view>
					</view>
					<view class="formitem">
						<view class="label">
							身份证号码
						</view>
						<view class="input">
							{{info.idcard||''}}
						</view>
					</view>
					<view class="form_title">
						<div class="line"></div>
						<text style="color: #333333;font-size: 30rpx;font-weight: bold;">企业营业执照</text>
					</view>
					<view class="pic_box">
						<image class="pic_bg" @click="imgPreview([info.buisness_image])"
							:src="baseurl+info.buisness_image" mode="aspectFit"></image>
					</view>
					<view class="form_title">
						<div class="line"></div>
						<text style="color: #333333;font-size: 30rpx;font-weight: bold;">食品经营许可证</text>
					</view>
					<view class="pic_box">
						<image class="pic_bg" @click="imgPreview([info.food_image])" :src="baseurl+info.food_image"
							mode="aspectFit"></image>
					</view>
				</view>
			</view>
			<!-- 贴牌 -->
			<view class="container" v-if="type=='oem'||type=='groupinfo'||type=='made'||type=='brand'||type=='online'">
				<view class="form">
					<view class="formitem">
						<view class="label">
							公司
						</view>
						<view class="input">
							{{info.company||''}}
						</view>
					</view>
					<view class="formitem" v-if="type!='online'">
						<view class="label">
							法人
						</view>
						<view class="input">
							{{info.major||''}}
						</view>
					</view>
					<view class="formitem">
						<view class="label">
							联系人
						</view>
						<view class="input">
							{{info.contacts||''}}
						</view>
					</view>
					<view class="formitem">
						<view class="label">
							联系电话
						</view>
						<view class="input">
							{{info.phone||''}}
						</view>
					</view>
					<view class="formitem" v-if="type=='oem'">
						<view class="label">
							联系邮箱
						</view>
						<view class="input">
							{{info.email||''}}
						</view>
					</view>
					<view class="formitem">
						<view class="label">
							注册地区
						</view>
						<view class="input">
							{{info.area||''}}
						</view>
					</view>
					<view class="form_title">
						<div class="line"></div>
						<text style="color: #333333;font-size: 30rpx;font-weight: bold;">企业营业执照</text>
					</view>
					<view class="pic_box">
						<image class="pic_bg" @click="imgPreview([info.buisness_image])"
							:src="baseurl+info.buisness_image" mode="aspectFit"></image>
					</view>
				</view>
			</view>

			<view class="btn">
				{{info.status||''}}
			</view>
		</view>
		<u-skeleton rows="8" title :loading='isloading'></u-skeleton>
	</view>




</template>

<script>
	import {
		getSubmit
	} from '@/api/my.js'
	export default {
		data() {
			return {
				info: {},
				baseurl: '',
				type: '',
				isloading: true
			};
		},
		onLoad(option) {

			this.type = decodeURI(option.type)
			let title = ''
			let url = ''
			switch (this.type) {
				case "oem":
					title = '贴牌资料'
					url = 'labeling'
					break;
				case "groupinfo":
					title = '团购商资料'
					url = 'grouppurchase'
					break;
				case "brand":
					title = '品牌开发商资料'
					url = 'brand'
					break;
				case "online":
					title = '电商资料'
					url = 'commerce'
					break;
				case "agent":
					title = '代理商资料'
					url = 'agent'
					break;
				case "made":
					title = '定制资料'
					url = 'customized'
					break;
			}

			uni.setNavigationBarTitle({
				title
			})


			this.baseurl = this.$BASE_URL
			getSubmit({type:option.type}).then(res=>{
				
				if(res.data.data){
					this.info=res.data.data
					this.isloading=false
				}else{
					// console.log(url)
					uni.navigateTo({
						url:'/pages/cooperation/'+url+'?type='+option.type
					})
					this.isloading=false
				}
			})
		},
		methods: {
			imgPreview(urls) {
				let us = []
				urls.map(t => {
					us.push(this.baseurl + t)
				})
				uni.previewImage({
					urls: us
				});
			},
		}
	}
</script>

<style lang="less">
	.container {
		.form {
			border-top: #F4F6F8 solid 2rpx;
			padding: 6rpx 28rpx 0 31rpx;

			.formitem {
				height: 99rpx;
				display: flex;
				align-items: center;
				border-bottom: 1rpx solid #F4F6F8;
				padding: 0 2rpx 0 10rpx;
				font-size: 30rpx;
				color: #333333;

				.label {
					width: 211rpx;
					font-weight: bold;
				}

				.input {
					// text-align: right;
					flex: 1;
				}

				.placeholder {
					font-size: 30rpx;
					color: #8B8B8B;
				}

				.more_icon {
					width: 21rpx;
					height: 31rpx;
				}
			}

			.form_title {
				height: 96rpx;
				display: flex;
				align-items: center;

				.line {
					width: 8rpx;
					height: 28rpx;
					background: #FE712A;
					border-radius: 4rpx;
					margin-right: 10rpx;
				}
			}
		}

	}

	.pic_box {
		.pic_bg {
			width: 198rpx;
			height: 198rpx;
			border-radius: 10rpx;
			background-color: #dedede;
		}
	}

	.btn {
		width: 687rpx;
		line-height: 114rpx;
		background: linear-gradient(153deg, #FF8717, #FF5F00);
		border-radius: 57rpx;
		text-align: center;
		color: #FFFFFF;
		font-size: 36rpx;
		margin: 73rpx 32rpx;
	}
</style>